#!/usr/bin/env bash
# Copyright (c) 2021 The Toltec Contributors
# SPDX-License-Identifier: MIT

pkgnames=(recrossable)
pkgdesc="Solve crossword puzzles"
url=https://github.com/sandsmark/recrossable
pkgver=0.0.0-8
timestamp=2021-01-15T12:58:22Z
section="games"
maintainer="Mattéo Delabre <spam@delab.re>"
license=GPL-2.0-or-later
installdepends=(libdlib display)
makedepends=(build:imagemagick build:librsvg2-bin host:libdlib host:libdlib-dev)
flags=(patch_rm2fb)

image=qt:v2.1
source=(
    https://github.com/sandsmark/recrossable/archive/234d5744c0b20087a588d0ecead0a9f58c1f323d.zip
    recrossable.draft
    recrossable.svg
)
sha256sums=(
    24b7512d295df504583ccdde7307e8f59fc561da638b992902b4ebccc412fa92
    SKIP
    SKIP
)

build() {
    cat << QMAKE >> recrossable.pro
linux-arm-remarkable-g++ {
    LIBS += -lqsgepaper
    DEFINES += REMARKABLE_DEVICE

    CONFIG += link_pkgconfig
    PKGCONFIG += dlib-1
}
QMAKE

    qmake
    make
    convert +set date:create +set date:modify recrossable.{svg,png}
}

package() {
    install -D -m 755 -t "$pkgdir"/opt/bin "$srcdir"/recrossable
    install -D -m 644 -t "$pkgdir"/opt/etc/draft "$srcdir"/recrossable.draft
    install -D -m 644 -t "$pkgdir"/opt/etc/draft/icons "$srcdir"/recrossable.png
}
